#include <iostream>
#include <math.h>
using namespace std;

#include "Triangle.h"

bool Triangle::isTrig()
{
    if (x + y <= z || x + z <= y || y + z <= x)
    {
        return false;
    }
    return true;
}

float Triangle::Area()
{
    float p = (x + y + z) / 2;
    return sqrt(p * (p - x) * (p - y) * (p - z));
}

Triangle::Triangle(float x, float y, float z)
{
    this->x = x;
    this->y = y;
    this->z = z;
}

void SumArea()
{
    Triangle t1(10, 20, 15);
    Triangle t2(11, 21, 31);

    if (!(t1.isTrig() && t2.isTrig()))
    {
        cout << "error" << endl;
        return;
    }

    cout << "两三角形的面积之和为：" << endl;
    cout << t1.Area() + t2.Area() << endl;
}